package com.umeox.recorder.data;

import android.content.Context;
import android.util.Log;

import androidx.annotation.VisibleForTesting;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;


@Database(entities = {RecorderBean.class}, version = 1, exportSchema = false)
public abstract class RecorderDataBase extends RoomDatabase {
    private static final String TAG = "AppDataBase";
    private static RecorderDataBase INSTANCE;

    private static final Object sLock = new Object();

    public abstract RecorderDao getRecorderDao();

    public static RecorderDataBase getInstance(Context context) {
        synchronized (sLock) {
            if (INSTANCE == null) {

                INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
                        RecorderDataBase.class, "recorder.db")
                        .allowMainThreadQueries()
                        .build();
            }
            return INSTANCE;
        }
    }
}
